Skip to contentSkip to conversation

Change in openvpn[master]: Fix check for struct cmsg not detecting the struct

Openvpn-devel In review plaisthos (Code Review) 2 participants 7 messages Sep 25, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1727273213000.Ia020c696f63a2a317f001c061b2ab4da69977750@...2715...

#1 lore raw

Attention is currently required from: flichtenheld.

Hello flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/771?usp=email

to review the following change.

Change subject: Fix check for struct cmsg not detecting the struct
......................................................................

Fix check for struct cmsg not detecting the struct

This check seems to have never worked and on Linux we hard coded the check instead. Remove this hard coded assumption and use a working check based on check_struct_has_member instead.

This is has the side-effect of port-sharing being enabled on macOS when compiled with cmake.

Change-Id: Ia020c696f63a2a317f001c061b2ab4da69977750
---
M CMakeLists.txt

1 file changed, 5 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/771/1

CMakeLists.txt +5 -2
index 6271574..5db207d 100644
@@ -131,7 +131,6 @@
     set(ENABLE_FEATURE_TUN_PERSIST 1)
     set(HAVE_LINUX_TYPES_H 1)
     set(ENABLE_DCO YES)
-    set(HAVE_CMSGHDR YES)
 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
     set(TARGET_FREEBSD YES)
     set(ENABLE_DCO YES)
@@ -185,7 +184,6 @@
 
 check_symbol_exists(sendmsg sys/socket.h HAVE_SENDMSG)
 check_symbol_exists(recvmsg sys/socket.h HAVE_RECVMSG)
-check_symbol_exists(cmsghdr sys/socket.h HAVE_CMSGHDR)
 check_symbol_exists(openlog syslog.h HAVE_OPENLOG)
 check_symbol_exists(syslog syslog.h HAVE_SYSLOG)
 check_symbol_exists(getgrnam grp.h HAVE_GETGRNAM)
@@ -193,6 +191,11 @@
 check_symbol_exists(getsockname sys/socket.h HAVE_GETSOCKNAME)
 check_symbol_exists(getrlimit "sys/time.h;sys/resource.h" HAVE_GETRLIMIT)
 
+# Checking for existence of structs with check_symbol_exists does not work,
+# so we use check_struct_hash_member with a member instead
+check_struct_has_member("struct cmsghdr" cmsg_len sys/socket.h HAVE_CMSGHDR)
+
+
 # Some OS (e.g. FreeBSD) need some basic headers to allow
 # including network headers
 set(NETEXTRA sys/types.h)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/771?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia020c696f63a2a317f001c061b2ab4da69977750
Gerrit-Change-Number: 771
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/771?usp=email )

Change subject: Fix check for struct cmsg not detecting the struct
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/771?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia020c696f63a2a317f001c061b2ab4da69977750
Gerrit-Change-Number: 771
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Wed, 25 Sep 2024 14:51:59 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/771?usp=email )

Change subject: Fix check for struct cmsg not detecting the struct
......................................................................

Patch Set 1:

(1 comment)

Commit Message:

http://gerrit.openvpn.net/c/openvpn/+/771/comment/386a6ce5_35191b54 :
PS1, Line 7: struct
Should probably add a "CMake:" in there.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/771?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia020c696f63a2a317f001c061b2ab4da69977750
Gerrit-Change-Number: 771
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Wed, 25 Sep 2024 14:52:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#4 lore raw

PATCH 1/1 Fix check for CMake not detecting struct cmsg

In reply to a message not in the archive

From: Arne Schwabe <[email protected]...>

This check seems to have never worked and on Linux we hard coded the check instead. Remove this hard coded assumption and use a working check based on check_struct_has_member instead.

This is has the side-effect of port-sharing being enabled on macOS when compiled with cmake.

Change-Id Ia020c696f63a2a317f001c061b2ab4da69977750

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/771
This mail reflects revision 1 of this Change.

Signed-off-by line for the author was added as per our policy.

Acked-by according to Gerrit (reflected above):
Frank Lichtenheld <[email protected]...>

CMakeLists.txt +5 -2
index 6271574..5db207d 100644
@@ -131,7 +131,6 @@
     set(ENABLE_FEATURE_TUN_PERSIST 1)
     set(HAVE_LINUX_TYPES_H 1)
     set(ENABLE_DCO YES)
-    set(HAVE_CMSGHDR YES)
 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
     set(TARGET_FREEBSD YES)
     set(ENABLE_DCO YES)
@@ -185,7 +184,6 @@
 
 check_symbol_exists(sendmsg sys/socket.h HAVE_SENDMSG)
 check_symbol_exists(recvmsg sys/socket.h HAVE_RECVMSG)
-check_symbol_exists(cmsghdr sys/socket.h HAVE_CMSGHDR)
 check_symbol_exists(openlog syslog.h HAVE_OPENLOG)
 check_symbol_exists(syslog syslog.h HAVE_SYSLOG)
 check_symbol_exists(getgrnam grp.h HAVE_GETGRNAM)
@@ -193,6 +191,11 @@
 check_symbol_exists(getsockname sys/socket.h HAVE_GETSOCKNAME)
 check_symbol_exists(getrlimit "sys/time.h;sys/resource.h" HAVE_GETRLIMIT)
 
+# Checking for existence of structs with check_symbol_exists does not work,
+# so we use check_struct_hash_member with a member instead
+check_struct_has_member("struct cmsghdr" cmsg_len sys/socket.h HAVE_CMSGHDR)
+
+
 # Some OS (e.g. FreeBSD) need some basic headers to allow
 # including network headers
 set(NETEXTRA sys/types.h)
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: Fix check for CMake not detecting struct cmsg

Haven't tested this beyond "buildbot says it's fine" :-) - and have changed the Subject: line as suggested.

Your patch has been applied to the master branch.

commit f77f298979851687ab8fe3948b82cfac27c95cf8

Author: Arne Schwabe
Date:   Wed Sep 25 17:13:42 2024 +0200
     Fix check for CMake not detecting struct cmsg

     Signed-off-by: Arne Schwabe <[email protected]...>
     Acked-by: Frank Lichtenheld <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg29448.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw

[Openvpn-devel] [XS] Change in openvpn[master]: Fix check for CMake not detecting struct cmsg

In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by plaisthos. ( http://gerrit.openvpn.net/c/openvpn/+/771?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by flichtenheld

Change subject: Fix check for CMake not detecting struct cmsg
......................................................................

Fix check for CMake not detecting struct cmsg

This check seems to have never worked and on Linux we hard coded the check instead. Remove this hard coded assumption and use a working check based on check_struct_has_member instead.

This is has the side-effect of port-sharing being enabled on macOS when compiled with cmake.

Change-Id Ia020c696f63a2a317f001c061b2ab4da69977750

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29448.html

---
M CMakeLists.txt

1 file changed, 5 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/71/771/2

CMakeLists.txt +5 -2
index 6271574..5db207d 100644
@@ -131,7 +131,6 @@
     set(ENABLE_FEATURE_TUN_PERSIST 1)
     set(HAVE_LINUX_TYPES_H 1)
     set(ENABLE_DCO YES)
-    set(HAVE_CMSGHDR YES)
 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
     set(TARGET_FREEBSD YES)
     set(ENABLE_DCO YES)
@@ -185,7 +184,6 @@
 
 check_symbol_exists(sendmsg sys/socket.h HAVE_SENDMSG)
 check_symbol_exists(recvmsg sys/socket.h HAVE_RECVMSG)
-check_symbol_exists(cmsghdr sys/socket.h HAVE_CMSGHDR)
 check_symbol_exists(openlog syslog.h HAVE_OPENLOG)
 check_symbol_exists(syslog syslog.h HAVE_SYSLOG)
 check_symbol_exists(getgrnam grp.h HAVE_GETGRNAM)
@@ -193,6 +191,11 @@
 check_symbol_exists(getsockname sys/socket.h HAVE_GETSOCKNAME)
 check_symbol_exists(getrlimit "sys/time.h;sys/resource.h" HAVE_GETRLIMIT)
 
+# Checking for existence of structs with check_symbol_exists does not work,
+# so we use check_struct_hash_member with a member instead
+check_struct_has_member("struct cmsghdr" cmsg_len sys/socket.h HAVE_CMSGHDR)
+
+
 # Some OS (e.g. FreeBSD) need some basic headers to allow
 # including network headers
 set(NETEXTRA sys/types.h)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/771?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia020c696f63a2a317f001c061b2ab4da69977750
Gerrit-Change-Number: 771
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#7 lore raw

[Openvpn-devel] [XS] Change in openvpn[master]: Fix check for CMake not detecting struct cmsg

In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/771?usp=email )

Change subject: Fix check for CMake not detecting struct cmsg
......................................................................

Fix check for CMake not detecting struct cmsg

This check seems to have never worked and on Linux we hard coded the check instead. Remove this hard coded assumption and use a working check based on check_struct_has_member instead.

This is has the side-effect of port-sharing being enabled on macOS when compiled with cmake.

Change-Id Ia020c696f63a2a317f001c061b2ab4da69977750

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29448.html

---
M CMakeLists.txt

1 file changed, 5 insertions(+), 2 deletions(-)
CMakeLists.txt +5 -2
index 6271574..5db207d 100644
@@ -131,7 +131,6 @@
     set(ENABLE_FEATURE_TUN_PERSIST 1)
     set(HAVE_LINUX_TYPES_H 1)
     set(ENABLE_DCO YES)
-    set(HAVE_CMSGHDR YES)
 elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
     set(TARGET_FREEBSD YES)
     set(ENABLE_DCO YES)
@@ -185,7 +184,6 @@
 
 check_symbol_exists(sendmsg sys/socket.h HAVE_SENDMSG)
 check_symbol_exists(recvmsg sys/socket.h HAVE_RECVMSG)
-check_symbol_exists(cmsghdr sys/socket.h HAVE_CMSGHDR)
 check_symbol_exists(openlog syslog.h HAVE_OPENLOG)
 check_symbol_exists(syslog syslog.h HAVE_SYSLOG)
 check_symbol_exists(getgrnam grp.h HAVE_GETGRNAM)
@@ -193,6 +191,11 @@
 check_symbol_exists(getsockname sys/socket.h HAVE_GETSOCKNAME)
 check_symbol_exists(getrlimit "sys/time.h;sys/resource.h" HAVE_GETRLIMIT)
 
+# Checking for existence of structs with check_symbol_exists does not work,
+# so we use check_struct_hash_member with a member instead
+check_struct_has_member("struct cmsghdr" cmsg_len sys/socket.h HAVE_CMSGHDR)
+
+
 # Some OS (e.g. FreeBSD) need some basic headers to allow
 # including network headers
 set(NETEXTRA sys/types.h)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/771?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ia020c696f63a2a317f001c061b2ab4da69977750
Gerrit-Change-Number: 771
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged